<template>
  <div class="page-container">
    <el-card class="m-20">
      <div slot="header">{{$route.name}}</div>
      <el-row>
        <el-col :span="3" class="text-right">名称：</el-col>
        <el-col :span="9">{{tenant.name}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">联系人：</el-col>
        <el-col :span="9">{{tenant.contact}}</el-col>
        <el-col :span="3" class="text-right">联系电话：</el-col>
        <el-col :span="9">{{tenant.phone}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">省：</el-col>
        <el-col :span="9">{{tenant.province}}</el-col>
        <el-col :span="3" class="text-right">市：</el-col>
        <el-col :span="9">{{tenant.city}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">地址：</el-col>
        <el-col :span="21">{{tenant.address}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">备注：</el-col>
        <el-col :span="21">{{tenant.description}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">创建人：</el-col>
        <el-col :span="9">{{tenant.createUser}}</el-col>
        <el-col :span="3" class="text-right">创建时间：</el-col>
        <el-col :span="9">{{tenant.createTime}}</el-col>
      </el-row>
      <hr class="line-sep">
      <el-row>
        <el-col :span="3" class="text-right">更新人：</el-col>
        <el-col :span="9">{{tenant.updateUser}}</el-col>
        <el-col :span="3" class="text-right">更新时间：</el-col>
        <el-col :span="9">{{tenant.updateTime}}</el-col>
      </el-row>
    </el-card>
  </div>
</template>
<script>
import * as Tenant from '@/api/tenant'
import * as District from '@/api/district'

export default {
  data() {
    return {
      tenant: { }
    }
  },
  created() {
    Tenant.get(this.$route.params.id).then(res => {
      res.data.province = res.data.city = null
      District.resolveProvinceAndCity(res.data.provinceId, res.data.cityId).then(pac => {
        res.data.province = pac[0] && pac[0].name
        res.data.city = pac[1] && pac[1].name
      })
      this.tenant = res.data
    }).catch(err => this.$message.error(err.message || err))
  },
  methods: {

  }
}
</script>
<style>

</style>